/* Turska UI library
 * Copyright 2003-2008 Jetro Lauha
 * All rights reserved.
 * Web: http://iki.fi/jetro/
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of EITHER:
 *   (1) The GNU Lesser General Public License as published by the Free
 *       Software Foundation; either version 2.1 of the License, or (at
 *       your option) any later version. The text of the GNU Lesser
 *       General Public License is included with this library in the
 *       file LICENSE-LGPL.txt.
 *   (2) The BSD-style license that is included with this library in
 *       the file LICENSE-BSD.txt.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files
 * LICENSE-LGPL.txt and LICENSE-BSD.txt for more details.
 *
 * $Id: UIButton.h,v 1.2 2008/03/27 11:44:22 tonic Exp $
 * $Revision: 1.2 $
 */

#ifndef UIBUTTON_H_INCLUDED
#define UIBUTTON_H_INCLUDED


class UIButton : public UIComponent
{
public:

    UIButton(INT x, INT y, UIImage *defaultImage = NULL, UIImage *pressedImage = NULL,
             UIImage *symbolImage = NULL, UIFont *font = NULL, const char *text = NULL,
             UINT32 fontFlags = UIFont::ALIGN_HORIZ_CENTER | UIFont::ALIGN_VERT_CENTER,
             INT textX = -1, INT textY = -1, INT itemPressedXOffset = 0, INT itemPressedYOffset = 1);
    virtual ~UIButton();

    bool isPressed() { return mIsPressed; }
    void setDefaultImage(UIImage *image) { mDefaultImage = image; }
    void setPressedImage(UIImage *image) { mPressedImage = image; }
    void setSymbolImage(UIImage *image) { mSymbolImage = image; }
    void setFont(UIFont *font) { mFont = font; }
    void setText(const char *text);
    void setColor(FLOAT red, FLOAT green, FLOAT blue, FLOAT alpha);
    void setItemColor(FLOAT red, FLOAT green, FLOAT blue, FLOAT alpha);
    UIImage * getDefaultImage() { return mDefaultImage; }
    UIImage * getPressedImage() { return mPressedImage; }
    UIImage * getSymbolImage() { return mSymbolImage; }
    UIFont * getFont() { return mFont; }
    const char * getText() { return mText; }

    virtual void onPointerDown(INT x, INT y);
    virtual void onPointerUp(INT x, INT y);
    virtual void onPointerMove(INT x, INT y);

    virtual void draw();

    void setSymbolImageDrawMode(UINT drawMode) { mSymbolImageDrawMode = drawMode; }
    void setSymbolImageFlags(UINT32 SymbolImageFlags) { mSymbolImageFlags = SymbolImageFlags; }
    UINT getSymbolImageDrawMode() { return mSymbolImageDrawMode; }
    UINT32 getSymbolImageFlags() { return mSymbolImageFlags; }

protected:

    BOOL mIsPressed;
    UIImage *mDefaultImage;
    UIImage *mPressedImage;
    UIImage *mSymbolImage;
    UINT mSymbolImageDrawMode;
    UINT32 mSymbolImageFlags;
    UIFont *mFont;
    char *mText;
    UINT32 mFontFlags;
    INT mTextX, mTextY;
    INT mItemPressedXOffset, mItemPressedYOffset;
    FLOAT mColor[4];
    FLOAT mItemColor[4];
};


#endif // !UIBUTTON_H_INCLUDED
